package com.shfl.servermanage.logic.api;

import com.shfl.servermanage.common.ApiResultHelper;
import com.shfl.servermanage.common.SystemConstant;
import com.shfl.servermanage.logic.model.request.RefactorRequest;
import com.shfl.servermanage.logic.service.ReleaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/refactor")
@Api(value = "站点构建", description = "站点构建")
public class RefactorController {
    @Autowired
    private ReleaseService releaseService;

    @PostMapping(value = "/execute")
    @ApiOperation(value = "重构", notes = "新增")
    public ApiResultHelper add(
            @RequestBody RefactorRequest refactorRequest
    ) throws Exception {
        releaseService.execute(refactorRequest);
        return new ApiResultHelper(SystemConstant.RE_SUCCESS_CODE);
    }


}
